from django.db import models
from django.contrib.auth.models import User


# Create your models here.

class BookModel(models.Model):
    name = models.CharField(max_length=50, verbose_name="书名")
    author = models.CharField(max_length=20, verbose_name="作者")
    description = models.TextField(verbose_name="描述")
    nums = models.PositiveIntegerField(default=0, verbose_name="在馆数量")
    borrower = models.ManyToManyField(User, verbose_name="借阅者", null=True)
    hot = models.PositiveIntegerField(default=0, verbose_name="借阅次数")

    def __str__(self):
        return self.name

    class Meta:
        verbose_name = "书籍"
